/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-24 05:33:45
 * @FilePath: \campus-repair-platform\server\common\sql_sentences\feedback.js
 */
/**
 * selectCount  总数查询
 * selectLimit  分页查询
 * selectCountLike 模糊查询总数
 * selectLikeLimit  分页模糊查询
 * idSelect     根据id获取反馈信息
 * insert 添加反馈
 */

const util = require("../util")
const table = "feedback"
const str = "name, type, f_number, title, content, time"
const like = "and title"

exports.selectCount = (data) =>
  util.selectCount(table, util.selectTransition(data))

exports.selectLimit = (data, page, pagesize) =>
  util.selectLimit(
    str,
    table,
    util.selectTransition(data),
    page,
    pagesize,
    'id desc'
  )

exports.selectCountLike = (data, d) => util.selectQueryCountLike(table, like, d, util.selectTransition(data))

exports.selectLikeLimit = (data, d, page, pagesize) =>
  util.selectQueryLikeLimit(str, table, like, d, page, pagesize, util.selectTransition(data), 'id desc')

exports.idSelect = (id) => util.idSelect(str, table, id)

exports.insert = (data) =>
  util.insert(table, util.insertStr(data), util.insertTransition(data))
